## World of Fantast
## Jeremy Keczan
## 05/12/2010
## main.py

import wx
import random

class mainFrame(wx.Frame):
    
    #must create a constructor function
    def __init__(self,parent,id):
        
        wx.Frame.__init__(self,parent,id,'World Of Fantast',size=wx.DisplaySize())                         #default constructor
        mainPanel = wx.Panel(self,-1,style=wx.SUNKEN_BORDER) 
        userPanel = wx.Panel(self,-1,style=wx.SUNKEN_BORDER)
        
        button=wx.Button(userPanel,label="Exit",pos=(130,130),size=(60,60))                              
        self.Bind(wx.EVT_BUTTON,self.closebutton,button)
        self.Bind(wx.EVT_CLOSE,self.closemainframe)
        
        randbutton=wx.Button(userPanel,label="Roll",pos=(130,10),size=(60,60))                              
        self.Bind(wx.EVT_BUTTON,self.genrandnum,randbutton)
        
        
        mainlayout = wx.BoxSizer(wx.HORIZONTAL)
        mainlayout.Add(mainPanel, 4, wx.EXPAND)
        mainlayout.Add(userPanel, 1, wx.EXPAND)

        self.SetAutoLayout(True)
        self.SetSizer(mainlayout)
        self.Layout()

        self.Bind(wx.EVT_CLOSE,self.closemainframe)
        
    def closemainframe(self,event):
        self.Destroy()
    def closebutton(self, event):
        self.Close(True)
        
    def genrandnum(self,event):
        num = random.randrange(1,7)
        print num
        
if __name__=='__main__':
    app=wx.PySimpleApp()
    frame = mainFrame(parent=None, id=-1)
    frame.Show()
    app.MainLoop()